<?php
class AdminModel extends CommonModel
{
	protected $tableName = 'ad_znz';
	
	public static $types = array(
		'1' => '超级管理员',
		'2' => '普通管理员'			
	);

	public function getByAccount($account, $field = '*') {
		$userInfo = array();
		if ($account) {
			$sql = 'account = "' . $account . '"';
			$userInfo = $this -> where($sql) -> field($field) -> find();
		}
	
		return $userInfo;
	} 
	
	/**
	 * 获取所有管理员
	 */
	public function getAdmins($where='', $field='*') {
		if (!$where)
			$where = 'status = 1';
		$list = $this -> where($where)
			-> field($field)
			->select();
		
		$userList = array();
		if ($list) {
			foreach ($list as $key => $val) {
				$userList[$val['id']] = $val;
			}
		}
		
		return $userList;
	}
	
}